import time
import allure
import pytest
from PO.page.page_login import PageLogin
from PO.page.page_me import PageMe
from utils.get_driver import UtilsDriver


class TestLoginFail():
    #TODO  初始化
    def setup_class(self):
        #TODO 获取登录页面对象
        self.login = PageLogin()
        # TODO 获取我的页面对象
        self.me=PageMe()

        with allure.step("测试步骤一：点击我的"):
            self.login.page_click_my()
            self.login.base_get_allure_image()

        with allure.step("测试步骤二：点击登录链接"):
            self.login.page_click_login()
            self.login.base_get_allure_image()

    #TODO 结束方法
    def teardown_class(self):
        self.driver=UtilsDriver().quit_app_driver()

    @pytest.mark.parametrize("name,password",[("18325539630",'123'),("1",'mike123456')])
    def test_login02(self,name,password):


        with allure.step("测试步骤三：输入用户名"):
            self.login.page_input_username(name)
            self.login.base_get_allure_image()

        with allure.step("测试步骤四：输入密码"):
            self.login.page_input_password(password)
            self.login.base_get_allure_image()

        with allure.step("测试步骤五：点击登录"):
            self.login.page_click_login_btn()
            self.login.base_get_allure_image()

        with allure.step("测试步骤六：点击确定按钮"):
            self.login.page_click_ok_btn()
            self.login.base_get_allure_image()